package bin_search;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;


public class main {

	public static void main(String[] args) {
		search w = new search();
		long time_start = 0;
		int max = 15;
		int x =7;
			int[] array = new int[max];
			Random ran = new Random();
			for (int i = 0; i<max; i++)
			{
				array[i]=Math.abs(ran.nextInt(20));
				System.out.printf(array[i] + "\t");
			}
			System.out.printf("\n");
			int tmp = 0;
			for (int j = 0; j < max - 1; j++)
			{
				for (int i = 0; i < max - j - 1; i++)
				{
					if  (array[i] > array[i+1])
					{
						tmp = array[i];
						array[i] = array[i+1];
						array[i+1] = tmp;
					}
				}
			}
			for (int i = 0; i<max; i++)
			{
				System.out.printf(array[i] + "\t");
			}
			time_start = System.currentTimeMillis();	
			System.out.printf("\nPosition is " + w.bin_search(array, max, x));
	}

}
